package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 活动类型(1-团购活动，2-报名活动，3-外部活动)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum ActiveTypeEnum {

    GROUP(1, "团购活动"),
    ENROLL(2, "报名活动"),
    EXTERNAL(3, "外部活动"),
    GROUP_ENROLL(4, "团购+报名活动"),
    POINTS(5, "积分活动"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    ActiveTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static ActiveTypeEnum typeOf(Integer value) {
        ActiveTypeEnum[] values = ActiveTypeEnum.values();
        for (ActiveTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static ActiveTypeEnum typeOf(String name) {
        ActiveTypeEnum[] values = ActiveTypeEnum.values();
        for (ActiveTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
